package com.xuxueli.xxlrpc.remoting.net;

import com.xuxueli.xxlrpc.remoting.invoker.reference.XxlRpcReferenceBean;
import com.xuxueli.xxlrpc.remoting.net.params.XxlRpcRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author：YH
 * @Description：
 * @Date:Created in 2022/5/29 15:32
 */
public abstract class Client {

    protected static final Logger logger = LoggerFactory.getLogger(Client.class);


    // ---------------------- init ----------------------

    protected volatile XxlRpcReferenceBean xxlRpcReferenceBean;

    public void init(XxlRpcReferenceBean xxlRpcReferenceBean) {
        this.xxlRpcReferenceBean = xxlRpcReferenceBean;
    }

    // ---------------------- send ----------------------

    /**
     * async send, bind requestId and future-response
     *
     * @param address
     * @param xxlRpcRequest
     * @return
     * @throws Exception
     */
    public abstract void asyncSend(String address, XxlRpcRequest xxlRpcRequest) throws Exception;

}
